<template>
  <div>
    <el-menu router :default-active="shopRouter">
      <el-submenu index="1" v-if="admin_type !=5&&admin_type !=6">
        <template slot="title">
          <i class="el-icon-s-data"></i>
          <span>数据中心</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="/data/test">测试</el-menu-item>
          <el-menu-item index="/data/storeData">商家数据</el-menu-item>
          <el-menu-item index="/data/shopList">商家列表</el-menu-item>
          <el-menu-item index="/data/userList" v-if="admin_type== 1">会员数据</el-menu-item>
          <el-menu-item index="/data/article" v-if="admin_type == 1">文章管理</el-menu-item>
           <!-- <el-menu-item index="/data/openShop" v-if="admin_type == 1">开店审核</el-menu-item> -->
          <el-menu-item index="/data/orderList">消费列表</el-menu-item>
          <el-menu-item index="/order/vip" v-if="admin_type== 1">会员开卡</el-menu-item>
            <el-menu-item index="/data/profitList" v-if="admin_type== 1||admin_type== 2||admin_type== 3"> 运营账户</el-menu-item>
             <el-menu-item index="/data/finance">财务账户</el-menu-item>
              <!-- <el-menu-item index="/data/monthPay" v-if="admin_type == 3">上月支出</el-menu-item> -->
        </el-menu-item-group>
      </el-submenu>

      <el-submenu index="4" v-if="admin_type == 1||admin_type==2">
        <template slot="title">
          <i class="el-icon-edit-outline"></i>
          <span>审核管理</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="/verify/shop" v-if="admin_type ==1" >商家审核</el-menu-item>
          <!-- <el-menu-item index="/verify/shop" v-if="admin_type ==1||admin_type == 3" >工资审核</el-menu-item> -->
          <el-menu-item index="/verify/cash" v-if="admin_type == 1" >提现审核</el-menu-item>
        </el-menu-item-group>
      </el-submenu>

      <el-submenu index="5">
        <template slot="title">
          <i class="el-icon-user"></i>
          <span>组织架构</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="/account/index">
          <span v-if="admin_type==1">
            城市代理商
          </span>
           <span v-if="admin_type==2">
            城市合伙人
          </span>
           <span v-if="admin_type==3">
            业务经理
          </span>

           <span v-if="admin_type==4">
            商户管理
          </span>
           <span v-if="admin_type==5">
            店员管理
          </span>



          </el-menu-item>



        </el-menu-item-group>
      </el-submenu>



      <!-- <el-submenu index="5" v-if="admin_type == 3">
        <template slot="title">
          <i></i>
          <span>系统管理</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="/account/index">业务经理</el-menu-item>
        </el-menu-item-group>
      </el-submenu> -->

      <!-- <el-submenu index="5" v-if="admin_type == 4">
        <template slot="title">
          <i></i>
          <span>系统管理</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="/account/index">商户管理</el-menu-item>
        </el-menu-item-group>
      </el-submenu> -->

      <el-submenu index="6" v-if="admin_type == 1||admin_type == 2||admin_type == 3||admin_type == 4">
        <template slot="title">
          <i class="el-icon-setting"></i>
          <span>系统设置</span>
        </template>
        <el-menu-item-group>
           <el-menu-item index="/system/code">邀请码管理</el-menu-item>
            <el-menu-item index="/shop/index">账户设置</el-menu-item>
          <el-menu-item index="/system/nav" v-if="admin_type == 1">导航管理</el-menu-item>
          <el-menu-item index="/system/cate"  v-if="admin_type == 1">分类管理</el-menu-item>
          <el-menu-item index="/system/banner"  v-if="admin_type == 1">广告管理</el-menu-item>
          <el-menu-item index="/system/msg"  v-if="admin_type == 1">信息管理</el-menu-item>
           <el-menu-item index="/system/vipRight" v-if="admin_type == 1">会员权益</el-menu-item>
            <el-menu-item index="/system/hot" v-if="admin_type == 1">热门搜索</el-menu-item>
          <el-menu-item index="/system/vip"  v-if="admin_type == 1">会费设置</el-menu-item>
          <el-menu-item index="/system/plan"  v-if="admin_type == 1">分账计划</el-menu-item>

        </el-menu-item-group>
      </el-submenu>

      <el-submenu index="2" v-if="admin_type == 5">
        <template slot="title">
          <i class="el-icon-s-shop"></i>
          <span>商家中心</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="/order/index">消费记录</el-menu-item>
          <el-menu-item index="/shop/index">基础信息</el-menu-item>
          <el-menu-item index="/shop/content">店铺简介</el-menu-item>
          <el-menu-item index="/shop/activity">活动列表</el-menu-item>
          <el-menu-item index="/shop/good">特色产品</el-menu-item>

        </el-menu-item-group>
      </el-submenu>
    </el-menu>
  </div>
</template>

<script>
export default {
  name: "asideBar",
  data() {
    return {
      shopRouter: "",
      adminRouter: "",
      admin_type: 1,
    };
  },
  mounted() {
    this.routeChange(this.$route); //刷新后，在mounted时，取到路由对象
    this.admin_type = localStorage.getItem("admin_type");
    console.log("账户类型：" + this.admin_type);
  },
  methods: {
    routeChange(route) {
      let shopPath = route.path;
      this.shopRouter = shopPath;
    },
  },
  watch: {
    $route(route) {
      //route==一路由信息对象
      this.routeChange(route);
    },
  },
};
</script>

<style scoped>
</style>
